<?php

	include ('../Model/proposta.class.php'); 
	include ('../Config/conn.php'); 
	
	session_start();

	$idProposta = isset($_POST['idProposta']) ? $_POST['idProposta'] : '';
	$cdUsuario = isset($_POST['cdUsuario']) ? $_POST['cdUsuario'] : '';
	
	$result = $db->query("SELECT * FROM `proposta`
								  WHERE `proposta`.`cd_proposta` = '$idProposta'",
								      PDO::FETCH_ASSOC);	
													  	
	if ($result->rowCount() > 0) {
		
		while($DBproposta = $result->fetch()){
									
			$Proposta = new Proposta($db, $DBproposta['cd_proposta'], $DBproposta['cd_logradouro'], $DBproposta['cd_forma_troca'], $DBproposta['cd_status'], $DBproposta['ds_obs']);	
			$Proposta->trocaExemplaresProposta($db, $cdUsuario);	
			
		}
	
		$result->closeCursor();	
	} 
	
	include ('../Config/destruct.php');
	
?>